\ Number input word Ham 12:00 11/01/92 \ These screens contain a number input word with additional \ support words for entry of several types of numbers: \ \ "Standard" numbers denoting amounts: commas inserted as \ needed, with option for decimals and negatives; numbers \ are entered calculator style. \ \ Social Security Numbers: no negatives, no decimals, no \ commas; number is entered typewriter style with hyphens.\ \ ATM style: decimal displayed from start, with calculator \ style entry; count of digits is not provided. \ \ Leading zeroes: for ID numbers like ZIP code; no commas, \ numbers entered typewriter style. \ Additions to the underlying Forth Ham 12:00 11/01/92 : -CUR 14 0 SET-CUR ; \ no cursor : +CUR 11 14 SET-CUR ; \ normal cursor (I made it larger). 0 CONSTANT NEW \ to collect new digits -1 CONSTANT OLD \ to provide existing number to routine 0. 2EQU XY \ will hold original x and y coordinates : HOME XY GOTOXY ; \ take cursor to start of data entry field : PCKEY ( -- ASCII-char -1 | IBM-special_char 0 ) KEY ?DUP IF TRUE ELSE KEY FALSE THEN ; \ Tools Ham 12:00 11/01/92 8 CONSTANT BSPKEY 13 CONSTANT ENTERKEY 83 CONSTANT DELKEY 72 CONSTANT UPKEY VARIABLE SOUND \ T if using sound SOUND ON \ default is sound : BELL ( - ) SOUND @ IF 440 25 BEEP ( short beep ) THEN ; 0 CONSTANT US>D \ convert unsigned single to double \ Tools Ham 12:00 11/01/92 : INCR ( a - ) 1 SWAP +! ; \ increment variable : DECR ( a - ) -1 SWAP +! ; \ decrement variable : }DECR ( a - ) DUP @ IF DECR \ decrement if non-zero ELSE DROP THEN ; \ no action if zero \ Variables Ham 12:00 11/01/92 VARIABLE DONE \ nonzero when number entry is complete VARIABLE #HIT \ count of digits entered VARIABLE DECIN \ count of decimal digits entered VARIABLE DECPT \ true if decimal point entered VARIABLE OK-NEG \ T allows for entry of - ; F rejects - VARIABLE NEG? \ true if number currently negative; required \ since - may be hit before any digits 0 EQU MAXDIGITS \ maximum number of digits to collect 0 EQU MAXDEC \ maximum number of decimal places allowed : PLACES ( n - ) EQU MAXDEC ; \ Typical number tasks Ham 12:00 11/01/92 : CAPITALIZE ( c - C ) DUP 96 > OVER 123 < AND IF BL - THEN ; : FIXUP ( c - c ) \ convert characters to equivalents CASE ASCII B OF ASCII C ENDOF ( B -> C ) BL OF ASCII C ENDOF ( space -> C ) ASCII L OF ASCII 1 ENDOF ( L -> 1 ) ASCII O OF ASCII 0 ENDOF ( O -> 0 ) DUP ENDCASE ; : #? ( n - f ) DUP ASCII / > SWAP ASCII : < AND ; \ leave TRUE if character is ASCII numeral : #COMMAS ( n1 - n2 ) 3 /MOD SWAP 0= + 0 MAX ; \ n1 = # of whole-number digits; n2 = # of commas required \ Special key edit Ham 12:00 11/01/92 : SPECBAD? ( n - f ) DUP DELKEY = OVER UPKEY = OR NOT ; \ For this example, I will recognize only two special keys: \ Del, which will act exactly as Backspace \ Up-arrow, which will act as the Enter key, terminating \ data entry, but will leave a different value in DONE \ The program can check the contents of DONE on exiting the \ routine to determine how the user ended the routine; in a \ real program, you would probably recognize Tab, Tab-left, \ Down-arrow, and possibly Left-arrow and Right-arrow, each of \ which would terminate data entry and leave its own special \ value in DONE. \ Is keystroke acceptable? Ham 12:00 11/01/92 : REGBAD? ( n - f ) DUP #? \ numeral ? #HIT @ MAXDIGITS < AND \ and not at max digits DECPT @ IF DECIN @ MAXDEC < AND \ and dec not at max ELSE #HIT @ MAXDEC + \ and if no decimal MAXDIGITS < AND THEN \ then room for whole OK-NEG @ IF OVER ASCII - = OR THEN \ or - ? (only if ok) MAXDEC DECPT @ NOT AND \ or . ? (if using dec IF OVER ASCII . = OR THEN \ and don't have it) OVER ASCII C = OR \ or C ? (for clear ) OVER BSPKEY = OR \ or Backspace ? SWAP ENTERKEY = OR \ or Enter? NOT ; \ if not any of above, \ then key is bad \ Standard display: length of entry field Ham 12:00 11/01/92 : +EXTRAS ( n - n' ) MAXDEC IF 1+ THEN OK-NEG @ IF 1+ THEN ; \ count the decimal point and the minus sign if allowed : BOXSIZE ( - m ) \ m = boxsize MAXDIGITS DUP \ # of digits to collect MAXDEC - \ leave number of whole digits DUP 1 < \ -1 if no whole digits, 0 otherwise NEGATE \ if no whole digits, add 1 for 0 before . * SWAP \ save the 1 or 0; # of whole digits on top #COMMAS \ # of commas based on # of whole digits + + \ sum: 1 or 0 + # of commas + # of digits +EXTRAS ; \ add for decimal point and minus sign \ * as in 0.13 -- need to leave room for the leading zero \ Standard display: signed doubles Ham 12:00 11/01/92 \ Assumes that #HIT contains number of digits entered and that \ DECIN contains no. of digits to right of decimal : .STD# ( d - adr cnt ) <# DECIN @ 0 ?DO # LOOP DECPT @ IF ASCII . HOLD THEN #HIT @ DECIN @ - #COMMAS 0 ?DO # # # ASCII , HOLD LOOP #S NEG? @ SIGN #> ; : STD#.R ( d n - ) >R .STD# R> OVER - SPACES TYPE ; \ n = field width \ Standard display: alternative .STD# Ham 12:00 11/01/92 \ If you don't like 0 in front of the decimal (as in 0.23) \ the following version deletes that. You will also need to \ revise BOXSIZE, which currently takes that leading 0 into \ account in determining the size of the entry field. \ : .STD# ( d - adr cnt ) \ <# DECIN @ 0 ?DO # LOOP \ DECPT @ IF ASCII . HOLD THEN \ #HIT @ DECIN @ - #COMMAS \ 0 ?DO # # # ASCII , HOLD LOOP \ #HIT @ DECIN @ <> IF #S THEN \ this is the change: \ NEG? @ SIGN #> ; \ display #S only if user \ has hit more keys than \ in decimal portion \ Standard display: sign and decimal point Ham 12:00 11/01/92 : BACK 8 EMIT ; \ backspaces cursor : -. ( display - or . or both when no digits yet entered ) NEG? @ DECPT @ AND IF BACK BACK ." -." ELSE NEG? @ IF BACK ASCII - EMIT ELSE DECPT @ IF BACK ASCII . EMIT THEN THEN THEN ; \ The number-display word requires a number to display; but \ user can press - and/or . before starting on the number \ proper, and those must be displayed as entered. \ Standard display Ham 12:00 11/01/92 \ Standard display: it allows for negatives, commas, and \ decimals, and computes the number of spaces required \ in the data-entry field. : STD-DISPLAY ( d - ) HOME #HIT @ IF BOXSIZE STD#.R \ display number ELSE 2DROP BOXSIZE SPACES -. THEN ; \ no number entered; \ display - or . if \ entered \ Clear the number Ham 12:00 11/01/92 : CLEAR# ( d - 0. ) \ this is the "clear-entry" function 2DROP 0. \ drop number and start over: #HIT OFF \ no digits entered DECIN OFF \ no decimals entered NEG? OFF \ no negative number MAXDEC MAXDIGITS = DECPT ! ; \ if only decimal digits can be entered, might as \ well start with decimal point already on. \ Backspace routine Ham 12:00 11/01/92 : BSP-ROUTINE ( d1 - d2 ) DECPT @ DECIN @ 0= AND IF DECPT OFF \ just backspaced out the decimal point ELSE #HIT @ IF 10 D/ #HIT DECR DECIN }DECR ELSE NEG? @ IF NEG? OFF \ bsp over - sign ELSE BELL THEN THEN THEN ; \ The backspace will be over a decimal point, a minus sign, or \ the last digit entered. It beeps if there's nothing to \ backspace over--i.e., if entry field is blank. \ When number is complete Ham 12:00 11/01/92 : SCALE# ( d - d' ) MAXDEC ?DUP IF DECIN @ - 0 ?DO 10 D* LOOP THEN ; \ complete the decimal part with trailing zeros \ SCALE# does not update #HIT, which counts only the digits \ the user actually entered. : #COMPLETE ( d - d' n ) \ leave scaled double and no. of digits entered \ if no. of digits is zero, then no digits were entered SCALE# NEG? @ IF DNEGATE THEN #HIT @ ; \ New digit entered Ham 12:00 11/01/92 : ADD-DIGIT ( d n - d' ) \ used for number keys ASCII 0 - \ convert ASCII value to number >R \ and save it 2DUP D0= DECPT @ NOT AND \ if number is 0 and no decimal pt IF #HIT OFF THEN \ don't count any digits as entered 10 D* R> US>D D+ \ append the new digit DECPT @ \ if decimal point already entered, IF DECIN INCR THEN \ count entry of decimal number #HIT INCR ; \ increment count of digits entered \ We start count over whenever at whole-number 0 because \ otherwise we would not be able to enter the full number of \ digits: entering 0123 would be counted as four digits, which \ works only if we are allowing leading zeroes, and we are not. \ Standard regular input key Ham 12:00 11/01/92 : STD-REGKEY ( d n - d ) CAPITALIZE FIXUP DUP REGBAD? IF ASCII , <> IF BELL THEN \ don't beep commas ELSE CASE ASCII - OF NEG? @ NOT NEG? ! ENDOF ASCII . OF DECPT ON ENDOF ASCII C OF CLEAR# ENDOF BSPKEY OF BSP-ROUTINE ENDOF ENTERKEY OF #COMPLETE DONE ON ENDOF \ if it falls thru to here, must be a number ADD-DIGIT 0 \ 0 is just for ENDCASE to drop ENDCASE THEN ; \ Standard special key input Ham 12:00 11/01/92 : STD-SPECKEY ( d n - d ) CASE DELKEY OF BSP-ROUTINE ENDOF UPKEY OF #COMPLETE 1 DONE ! ENDOF ENDCASE ; \ Up-arrow terminates entry with DONE containing 1 instead \ of the -1 it contains when the Enter key terminates entry. \ New number to collect Ham 12:00 11/01/92 : NEW# ( - d ) 0. \ put a double on the stack CLEAR# ; \ and clear everything \ leave number ready to display; display word shows a blank \ field until #HIT is nonzero. \ Old number to collect Ham 12:00 11/01/92 VARIABLE #DIGITS \ number of digits for old no. : #OFDIGITS ( d - ) DABS <# #S #> #DIGITS ! DROP ; \ Takes digit count from conversion routine, drops address : OLD# ( d - d ) 2DUP #OFDIGITS #DIGITS @ MAXDEC MAX #HIT ! \ #s stored with all decimals DUP ( top byte ) 0< NEG? ! DABS \ NEG? indicates sign MAXDEC DUP DECIN ! 0> DECPT ! ; \ Old number now ready for display \ Vectors for DIGITS Ham 12:00 11/01/92 VARIABLE DISPLAY# \ display word VARIABLE REG# \ routine for regular keys VARIABLE SPEC# \ routine for special keys VARIABLE SET# \ routine to initialize number \ These must be initialized before executing DIGITS. \ You also use PLACES to set number of decimals and turn \ OK-NEG on or off depending on whether negative numbers are \ allowed or not. \ Setting up DIGITS Ham 12:00 11/01/92 : STD-SET# ( d n T - d OR n F - d ) ?XY 2EQU XY \ save x and y coordinates DONE OFF SWAP \ deal with flag later EQU MAXDIGITS \ save maximum number of digits IF OLD# \ now use flag: T = old number present ELSE NEW# \ F = starting with new number THEN ; \ This set-up routine can be used for just about anything \ except the leading-zero situation. \ DIGITS Ham 12:00 11/01/92 : DIGITS ( d n T - d n OR n F - d n ) REVERSE SET# PERFORM BEGIN 2DUP DISPLAY# PERFORM PCKEY IF REG# PERFORM ELSE SPEC# PERFORM THEN DONE @ UNTIL -REVERSE ; \ The programmer must take care of turning cursor off and on. \ The special keys routine can be expanded to take care of \ keys such as up and down arrow, PgUp, PgDn, function keys, \ and the like. In this version, all special keys are beeped \ except for Del and Up-arrow. \ Set-up word for normal numbers Ham 12:00 11/01/92 \ Set-up word for normal number entry; OK-NEG and PLACES must \ be set separately as needed. : NORMAL ['] STD-DISPLAY DISPLAY# ! ['] STD-REGKEY REG# ! ['] STD-SPECKEY SPEC# ! ['] STD-SET# SET# ! ; \ By making the set-up word an adjective, it works well in \ normal phrasing. \ Test Ham 12:00 11/01/92 \ Load this screen to test standard routine ( Set-up: ) 0 PLACES OK-NEG OFF SOUND ON -CUR CR .( Enter a non-negative whole number less than 100,000: ) 5 NORMAL NEW DIGITS CR CR .( You entered ) . .( digits; the number as saved is ) D. --> \ Continuation of test Ham 12:00 11/01/92 CR CR 2 PLACES OK-NEG ON .( Enter a number to hundredths; it can be negative: ) 7 NEW DIGITS CR CR .( You entered ) . .( digits; the number as saved is ) 2DUP D. CR .( The last two places are to the right of the decimal.) CR CR --> \ Continuation of test Ham 12:00 11/01/92 .( Now revise the number you last entered: ) \ Still on the stack is the copy of the last number 7 OLD NORMAL DIGITS CR CR \ NORMAL is not required here, but it does no harm. .( You entered ) . .( digits; the number as saved is ) D. CR .( The last two places are to the right of the decimal.) CR CR +CUR \ SSN Display Ham 12:00 11/01/92 VARIABLE #LEFT \ number of digits still to display : SSNDIGITS ( adr n - adr' ) 0 DO #LEFT @ IF COUNT EMIT #LEFT DECR ELSE SPACE THEN LOOP ; : .SSN ( d - ) \ display as many digits as present <# #S #> #LEFT ! \ convert number, save count 3 SSNDIGITS ASCII - EMIT \ display first 3 digits and - 2 SSNDIGITS ASCII - EMIT \ next 2 digits and - 4 SSNDIGITS DROP ; \ last 4 digits : SSN-DISPLAY ( d - ) HOME #HIT @ IF .SSN ELSE 2DROP ." - - " THEN ; \ SSN regular input key Ham 12:00 11/01/92 : SSN-REGKEY ( d n - d ) CAPITALIZE FIXUP DUP REGBAD? IF ASCII , <> IF BELL THEN \ don't beep commas ELSE CASE ASCII - OF ( no action ) ENDOF ASCII . OF DECPT ON ENDOF ASCII C OF CLEAR# ENDOF BSPKEY OF BSP-ROUTINE ENDOF ENTERKEY OF #COMPLETE DONE ON ENDOF \ at this point, must be a number key ADD-DIGIT 0 \ 0 just for ENDCASE to drop ENDCASE THEN ; \ This version differs from STD-REGKEY only in that - is \ ignored (silently). \ Set-up word for SSN input Ham 12:00 11/01/92 \ Set-up word for Social Security Number entry; because we \ know the format, this word can go ahead and take care of \ OK-NEG and PLACES. Because the user may enter the hyphens \ OK-NEG is set on, and a special version of REGKEY is used \ that ignores the hyphen if it is entered. : SSN ['] SSN-DISPLAY DISPLAY# ! ['] SSN-REGKEY REG# ! ['] STD-SPECKEY SPEC# ! ['] STD-SET# SET# ! OK-NEG ON 0 PLACES ; \ Test of SSN entry Ham 12:00 11/01/92 CR CR .( Enter a Social Security Number: ) -CUR 9 NEW SSN DIGITS CR CR .( You entered ) . .( digits: ) .SSN CR CR CR +CUR \ ATM display: edit keystroke Ham 12:00 11/01/92 : ATMBAD? ( n - f ) DUP #? \ numeral ? #HIT @ MAXDIGITS < AND \ and not at max digits OK-NEG @ IF OVER ASCII - = OR THEN \ or - ? (only if ok) OVER ASCII C = OR \ or C ? (for clear ) OVER BSPKEY = OR \ or Backspace ? SWAP ENTERKEY = OR \ or Enter? NOT ; \ if not any of above, \ then key is bad \ Don't have to worry about decimal point or the number of \ decimal digits entered. \ ATM display: display number Ham 12:00 11/01/92 \ ATM display allows for negatives, commas, and decimals, and \ computes the number of spaces required in the data-entry \ field. Digits appear at the end of the decimal field. Field \ shows leading zeroes with minus sign (if any) at extreme left. : ATM# ( d - adr cnt ) <# MAXDEC ?DUP IF 0 DO # LOOP ASCII . HOLD THEN MAXDIGITS MAXDEC - #COMMAS DUP >R 0 ?DO # # # ASCII , HOLD LOOP MAXDIGITS MAXDEC - R> 3 * - 0 DO # LOOP NEG? @ SIGN #> ; : ATM#.R ( d n - ) >R ATM# R> OVER - SPACES TYPE ; \ n = field : ATM-DISPLAY ( d - ) HOME BOXSIZE ATM#.R ; \ ATM display: clear Ham 12:00 11/01/92 : ATM-CLEAR ( d - 0. ) \ the "clear-entry" function 2DROP 0. \ drop number and start over #HIT OFF \ no digits entered DECIN OFF \ no decimals entered DECPT ON \ decimal point entered NEG? OFF ; \ no negative number \ ATM display: backspace and # complete Ham 12:00 11/01/92 : ATM-BSP ( d1 - d2 ) #HIT @ IF 10 D/ #HIT DECR ELSE NEG? @ IF NEG? OFF \ bsp over the - sign ELSE BELL THEN THEN ; \ The backspace will be over a minus sign, or the last digit \ entered. In the ATM situation, the user cannot backspace \ over the decimal point. : ATM#COMPLETE ( d - d' ) \ leaves double only, not number of digits entered: with \ this word you cannot distinguish no entry and entered zero NEG? @ IF DNEGATE THEN ; \ ATM display: new digit Ham 12:00 11/01/92 : ATM-DIGIT ( d n - d' ) \ used for number keys ASCII 0 - \ convert ASCII value to number >R \ and save it 2DUP D0= R@ 0= AND \ if number is 0 and 0 entered IF #HIT DECR THEN \ don't count it 10 D* R> US>D D+ \ append the new digit #HIT INCR ; \ update count of digits entered \ We don't encounter the situation of the whole-number zero, but\ we don't want to count leading zeroes: a user who pushes \ zero repeatedly isn't changing the value of the data-entry \ field, and in that sense is not entering any numbers. So we \ don't start counting until we get a non-zero digit. \ ATM input and set-up Ham 12:00 11/01/92 : ATM-REGKEY ( d n - d ) CAPITALIZE FIXUP DUP ATMBAD? IF ASCII , <> IF BELL THEN \ don't beep commas ELSE CASE ASCII - OF NEG? @ NOT NEG? ! ENDOF ASCII C OF ATM-CLEAR ENDOF BSPKEY OF ATM-BSP ENDOF ENTERKEY OF ATM#COMPLETE DONE ON ENDOF \ at this point, must be a number key ATM-DIGIT 0 \ 0 just for ENDCASE to drop ENDCASE THEN ; : ATM-SPECKEY ( d n - d ) CASE DELKEY OF ATM-BSP ENDOF UPKEY OF ATM#COMPLETE 1 DONE ! ENDOF ENDCASE ; \ ATM set-up Ham 12:00 11/01/92 : ATM-OLD# ( d - d ) 2DUP #OFDIGITS #DIGITS @ #HIT ! \ ATM pushes numbers over fixed dec point DUP ( top byte ) 0< NEG? ! DABS \ NEG? indicates sign MAXDEC DUP DECIN ! 0> DECPT ! ; : ATM-SET# ( d n T - d OR n F - d ) ?XY 2EQU XY DONE OFF SWAP EQU MAXDIGITS \ save maximum IF ATM-OLD# ELSE NEW# THEN ; : ATM ['] ATM-DISPLAY DISPLAY# ! ['] ATM-REGKEY REG# ! ['] ATM-SPECKEY SPEC# ! ['] ATM-SET# SET# ! ; \ ATM test Ham 12:00 11/01/92 -CUR OK-NEG ON 2 PLACES CR CR .( Enter a number ATM style. It can be negative: ) 7 NEW ATM DIGITS CR CR .( You entered ) 2DUP D. CR CR .( Now revise it: ) 7 OLD DIGITS CR CR .( It is now ) D. CR CR +CUR \ Leading zeroes: length of entry field Ham 12:00 11/01/92 : LEAD0BOX ( - m ) \ m = boxsize MAXDIGITS \ # of digits to collect MAXDEC IF 1+ THEN \ plus 1 if decimal point OK-NEG @ IF 1+ THEN ; \ plus 1 if minus sign \ No commas: leading zero numbers are typically ID numbers \ that don't use commas. \ Leading zeroes: display Ham 12:00 11/01/92 \ Assumes that #HIT contains number of digits entered and that \ DECIN contains no. of digits to right of decimal. Leading \ zero numbers are typically identification numbers; they will \ seldom allow decimals or negatives and are best displayed \ typewriter style. Starting at the left is tricky only in \ determining how to leave room for the negative sign. : .LEAD0# ( d - adr cnt ) <# DECIN @ 0 ?DO # LOOP DECPT @ IF ASCII . HOLD THEN #HIT @ DECIN @ - 0 ?DO # LOOP \ forces the leading 0's OK-NEG @ IF NEG? @ ?DUP IF SIGN ELSE BL HOLD THEN THEN #> LEAD0BOX OVER - -ROT TYPE SPACES ; \ Spaces displayed after the number write over deleted digits. \ Leading zeroes: display Ham 12:00 11/01/92 \ Displays leading zeroes but not commas. Allows for negatives \ and decimals, and computes the number of spaces required \ in the data-entry field. : LEAD0-DISPLAY ( d - ) HOME #HIT @ IF .LEAD0# \ display number ELSE 2DROP LEAD0BOX NEG? @ DECPT @ AND IF ." -." 2- ELSE NEG? @ IF ASCII - EMIT 1- ELSE DECPT @ IF ASCII . EMIT 1- THEN THEN THEN SPACES THEN ; \ In this display, decimal point and minus sign go at the left. \ Leading zeroes: digit entered Ham 12:00 11/01/92 : LEAD0 ( d n - d' ) \ used for number keys ASCII 0 - \ convert ASCII value to numeric value >R \ put it aside for a moment 10 D* R> US>D D+ \ append the new digit DECPT @ \ if decimal point already entered, IF DECIN INCR THEN \ count entry of decimal number #HIT INCR ; \ update count of digits entered \ In this case we count every digit entered, including the \ leading zeroes, because we assume that the leading zeroes \ (which are displayed) are significant: e.g., ZIP codes. \ Leading zeroes: input and set-up Ham 12:00 11/01/92 : LEAD0-REGKEY ( d n - d ) CAPITALIZE FIXUP DUP REGBAD? IF ASCII , <> IF BELL THEN \ don't beep commas ELSE CASE ASCII - OF NEG? @ NOT NEG? ! ENDOF ASCII . OF DECPT ON ENDOF ASCII C OF CLEAR# ENDOF BSPKEY OF BSP-ROUTINE ENDOF ENTERKEY OF #COMPLETE DONE ON ENDOF \ at this point, must be a number key LEAD0 0 \ 0 just for ENDCASE to drop ENDCASE THEN ; \ Leading zeroes: old numbers Ham 12:00 11/01/92 \ #DIGITS, a variable previously defined, is assumed to hold \ the number of digits (including leading zeroes) for the old \ number. Thus #DIGITS must be initialized before executing \ DIGITS. : LEAD0OLD ( d - d ) #DIGITS @ #HIT ! DUP ( top byte ) 0< NEG? ! DABS MAXDEC DUP DECIN ! 0> DECPT ! ; \ The programmer must put into #DIGITS the number of digits to \ display for the old number. \ Leading zeroes: SET Ham 12:00 11/01/92 : LEAD0-SET# ( d n T - d OR n F - d ) ?XY 2EQU XY \ save x and y coordinates DONE OFF SWAP \ deal with flag later EQU MAXDIGITS \ save maximum number of digits IF LEAD0OLD \ now use flag: T = old number present ELSE NEW# \ F = starting with new number THEN ; \ Leading zeroes: set-up Ham 12:00 11/01/92 : LEAD0 ['] LEAD0-DISPLAY DISPLAY# ! ['] LEAD0-REGKEY REG# ! ['] STD-SPECKEY SPEC# ! ['] LEAD0-SET# SET# ! ; \ Leading zeroes: test Ham 12:00 11/01/92 -CUR OK-NEG ON 2 PLACES CR CR .( Enter number with leading zeroes, 2 decimals, & negative if you want: ) 7 NEW LEAD0 DIGITS CR CR .( You entered ) . .( digits, stored as: ) D. CR CR .( Now enter a five-digit ZIP code with leading zeroes: ) 0 PLACES OK-NEG OFF 5 NEW DIGITS CR CR DUP . .( digits were entered, with a value of ) 0 2OVER D. DROP ( Drop 0; just used it so 2OVER would work ) CR CR --> \ Leading zeroes: test continuation Ham 12:00 11/01/92 .( Now revise the number: ) #DIGITS ! \ number of digits entered previously 5 OLD DIGITS CR CR .( This time you entered ) . .( digits and the value is ) D. CR CR +CUR \ Exercise Ham 12:00 11/01/92 \ Take the appropriate screens from this file and create the \ file #INPUT.SCR that is suitable to be included in your \ programs with the phrase INCLUDE #INPUT.SCR. \ This is along the lines of what I did in taking the essential \ code from SORT.SCR to create the file SORTCODE.SCR to be \ used with INCLUDE.